package br.edu.ufcg.dsc.actions.configuration;

import org.apache.struts2.config.Result;
import org.apache.struts2.dispatcher.ServletDispatcherResult;

import br.edu.ufcg.dsc.actions.BaseLoggedAction;
import br.edu.ufcg.dsc.domain.configuration.Configuration;
import br.edu.ufcg.dsc.services.ConfigurationService;

/**
 * @author Diogo, Felipe, Vinicius 
 */
@Result(name = "success", type = ServletDispatcherResult.class, value = "/jsp/configuration/configuration.jsp")
public class ConfigurationAction extends BaseLoggedAction{

	private static final long serialVersionUID = 1L;
	private int studentDays, teacherDays;
	private double valueOfFine;
	private Configuration configuration;
	
	@Override
	protected String executeIfLogged() {
		configuration = ConfigurationService.getConfiguration();
		setStudentDays(configuration.getStudentDays());
		setTeacherDays(configuration.getTeacherDays());
		setValueOfFine(configuration.getValueOfFine());
		return SUCCESS;
	}

	public int getStudentDays() {
		return studentDays;
	}

	public void setStudentDays(int studentDays) {
		this.studentDays = studentDays;
	}

	public int getTeacherDays() {
		return teacherDays;
	}

	public void setTeacherDays(int teacherDays) {
		this.teacherDays = teacherDays;
	}

	public double getValueOfFine() {
		return valueOfFine;
	}

	public void setValueOfFine(double valueOfFine) {
		this.valueOfFine = valueOfFine;
	}
}
